<template>
	<view class="increase_width">
		<view class="uni-list">
			<view class="uni-list-cell"  @click="jump" data-src="../../member/info/info">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">会员资料</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="jump" data-src="../../member/address/address">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">地址管理</text>
				</view>
			</view>
		</view>
		<view class="uni-list">
			<view class="uni-list-cell"  @click="password">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">设置登录密码</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="jump" data-src="../../member/bind/bind">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">手机绑定</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="jumpdata" data-src="./bindtel">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">数据同步</text>
				</view>
			</view>
			
		</view>
		<view class="uni-list">
			<view class="uni-list-cell"  @click="jumpsure">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">清空缓存</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="password">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">微信公众号</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="jump" data-src="./about_us">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">关于我们</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="checknew">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">检查更新</text>
				</view>
			</view>
			<view class="uni-list-cell"  @click="jump" data-src="./invite_code">
				<view class="uni-list-cell-navigate uni-navigate-right">
					<text class="text">邀请码</text>
				</view>
			</view>
		</view>
		<view class="btn">
			<button class="logout" style="background-color: #05052B;" @click="logout">退出登录</button>
		</view>
	</view>
	
</template>

<script>
	export default {
		data(){
			return {
				openid:''
			}
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
				},
				fail: () => {}
			});
			uni.hideLoading()
		},
		methods: {
			jumpdata(){
				uni.request({
					url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=member&app=1',
					method: 'POST',
					data: {'openid':this.openid},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res.data.mobile)
						
						if(!res.data.mobile) {
							uni.navigateTo({
								url: '../../member/bind/telephone'
							})
							return
						}
						if(res.data.status ==0){
							uni.showToast({
								title: res.data.result.message,
								icon:"none"
							});
							setTimeout(() =>{
								uni.navigateTo({
									url: '../../member/info/info'
								});
							},2000)
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
			logout(){
				uni.showModal({
					content: "是否退出登录",
					confirmText: "确定",
					cancelText: "取消",
					success: res => {
						if(res.confirm){
							uni.clearStorageSync()
							uni.reLaunch({
								url: '../../home/home'
							});
						}
					}
				})
			},
			password() {
				uni.showModal({
				title:'提示',
				content:'功能暂未开放',
				showCancel: false,
				confirmColor:"#DD524D",
					success() {
						return
					}
				})
			},
			jumpsure() {
				uni.showModal({
				title:'',
				content:'清除成功',
				showCancel: false,
				confirmColor:"#DD524D",
					success() {
						return
					}
				})
			},
			checknew(){
				uni.showModal({
				title:'',
				content:'已经是最新的版本啦',
				showCancel: false,
				confirmColor:"#DD524D",
					success() {
						return
					}
				})
			}
		}
	}
</script>

<style>
	.btn {padding:20upx 0;}
	.btn button {margin:20upx 0;font-size:28upx;padding:12upx;}
	.btn .logout {border-color:#175e3c;color: #fff;}
	.uni-list {font-weight: 600;border-radius: 10upx; margin-top: 20upx;}
	.uni-list-cell {height: 100upx;line-height: 100upx;}
	.uni-list-cell.active {background:#f5f5f5;}
	.uni-list image {width:34upx;height:34upx;}
	.uni-list .text {position:absolute;left:44upx;font-size:26upx;top: 0;}
	.uni-list {margin-top:20upx;}
	.uni-list:before,.uni-list:after {display:none;}
	.uni-list-cell:after {content:" ";position:absolute;left:0.5rem;right:0.5rem;bottom:-1px;height:1px;border-top:1px solid #ebebeb;color:#D9D9D9;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(0.5);-ms-transform:scaleY(0.5);transform:scaleY(0.5);background:none;}
	.uni-list-cell .right {font-size:24upx;color:#999;margin-right:20upx;}
	.uni-list .uni-list-cell:last-child:after {border:0;}
	.uni-list .uni-badge {margin-right:15px;background-color:#f55;}
	.increase_width {width: 95%;margin: 0 auto;}
</style>